<!DOCTYPE HTML>
<html lang="zh-CN">


<head>
    <meta charset="utf-8">
    <meta name="keywords" content="docker, Python,HTML,CSS,JavaScript,Web安全等">
    <meta name="description" content="">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta name="renderer" content="webkit|ie-stand|ie-comp">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <!-- Global site tag (gtag.js) - Google Analytics -->


    <title>docker | 孤狼</title>
    <link rel="icon" type="image/png" href="/a.png">

    <link rel="stylesheet" type="text/css" href="/libs/awesome/css/all.css">
    <link rel="stylesheet" type="text/css" href="/libs/materialize/materialize.min.css">
    <link rel="stylesheet" type="text/css" href="/libs/aos/aos.css">
    <link rel="stylesheet" type="text/css" href="/libs/animate/animate.min.css">
    <link rel="stylesheet" type="text/css" href="/libs/lightGallery/css/lightgallery.min.css">
    <link rel="stylesheet" type="text/css" href="/css/matery.css">
    <link rel="stylesheet" type="text/css" href="/css/my.css">

    <script src="/libs/jquery/jquery.min.js"></script>
	<script src="https://sdk.jinrishici.com/v2/browser/jinrishici.js" charset="utf-8"></script>

<meta name="generator" content="Hexo 5.4.0"><link rel="stylesheet" href="/css/prism-tomorrow.css" type="text/css"></head>




<body>
    <header class="navbar-fixed">
    <nav id="headNav" class="bg-color nav-transparent">
        <div id="navContainer" class="nav-wrapper container">
			<div class="brand-logo">
				<a href="/" class="waves-effect waves-light">
					<div>
						
						<img src="/loading.gif" data-original="/medias/logo.png" class="logo-img" alt="LOGO">
						
						<span class="logo-span">孤狼</span>
					</div>
				</a>
			</div>
            

<a href="#" data-target="mobile-nav" class="sidenav-trigger button-collapse"><i class="fas fa-bars"></i></a>
<ul class="right nav-menu">
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/" class="waves-effect waves-light">
      
      <i class="fas fa-home" style="zoom: 0.6;"></i>
      
      <span>首页</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/categories" class="waves-effect waves-light">

      
      <i class="fas fa-bookmark" style="zoom: 0.6;"></i>
      
      <span>分类</span>
      <i class="fas fa-chevron-down" aria-hidden="true" style="zoom: 0.6;"></i>
    </a>
    <ul class="sub-nav menus_item_child ">
      
      <li>
        <a href="/categories/linux">
          
          <span>linux</span>
        </a>
      </li>
      
      <li>
        <a href="/categories/python">
          
          <span>python</span>
        </a>
      </li>
      
      <li>
        <a href="/categories/%E5%8D%9A%E5%AE%A2">
          
          <span>博客</span>
        </a>
      </li>
      
    </ul>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/tags" class="waves-effect waves-light">
      
      <i class="fas fa-tags" style="zoom: 0.6;"></i>
      
      <span>标签</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/archives" class="waves-effect waves-light">
      
      <i class="fas fa-archive" style="zoom: 0.6;"></i>
      
      <span>归档</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/about" class="waves-effect waves-light">
      
      <i class="fas fa-user-circle" style="zoom: 0.6;"></i>
      
      <span>关于</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/friends" class="waves-effect waves-light">
      
      <i class="fas fa-address-book" style="zoom: 0.6;"></i>
      
      <span>友情链接</span>
    </a>
    
  </li>
  
  <li>
    <a href="#searchModal" class="modal-trigger waves-effect waves-light">
      <i id="searchIcon" class="fas fa-search" title="搜索" style="zoom: 0.85;"></i>
    </a>
  </li>
</ul>


<div id="mobile-nav" class="side-nav sidenav">

    <div class="mobile-head bg-color">
        
        <img src="/loading.gif" data-original="/medias/logo.png" class="logo-img circle responsive-img">
        
        <div class="logo-name">孤狼</div>
        <div class="logo-desc">
            
            Never really desperate, only the lost of the soul.
            
        </div>
    </div>

    

    <ul class="menu-list mobile-menu-list">
        
        <li class="m-nav-item">
	  
		<a href="/" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-home"></i>
			
			首页
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="javascript:;">
			
				<i class="fa-fw fas fa-bookmark"></i>
			
			分类
			<span class="m-icon"><i class="fas fa-chevron-right"></i></span>
		</a>
            <ul  style="background:  ;" >
              
                <li>

                  <a href="/categories/linux " style="margin-left:75px">
				  
		          <span>linux</span>
                  </a>
                </li>
              
                <li>

                  <a href="/categories/python " style="margin-left:75px">
				  
		          <span>python</span>
                  </a>
                </li>
              
                <li>

                  <a href="/categories/%E5%8D%9A%E5%AE%A2 " style="margin-left:75px">
				  
		          <span>博客</span>
                  </a>
                </li>
              
            </ul>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/tags" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-tags"></i>
			
			标签
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/archives" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-archive"></i>
			
			归档
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/about" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-user-circle"></i>
			
			关于
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/friends" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-address-book"></i>
			
			友情链接
		</a>
          
        </li>
        
        
    </ul>
</div>


        </div>

        
    </nav>

</header>

    
<script src="/libs/cryptojs/crypto-js.min.js"></script>
<script>
    (function() {
        let pwd = '';
        if (pwd && pwd.length > 0) {
            if (pwd !== CryptoJS.SHA256(prompt('请输入访问本文章的密码')).toString(CryptoJS.enc.Hex)) {
                alert('密码错误，将返回主页！');
                location.href = '/';
            }
        }
    })();
</script>




<div class="bg-cover pd-header post-cover" style="background-image: url('/medias/featureimages/8.jpg')">
    <div class="container" style="right: 0px;left: 0px;">
        <div class="row">
            <div class="col s12 m12 l12">
                <div class="brand">
                    <h1 class="description center-align post-title">docker</h1>
                </div>
            </div>
        </div>
    </div>
</div>




<main class="post-container content">

    
    <link rel="stylesheet" href="/libs/tocbot/tocbot.css">
<style>
    #articleContent h1::before,
    #articleContent h2::before,
    #articleContent h3::before,
    #articleContent h4::before,
    #articleContent h5::before,
    #articleContent h6::before {
        display: block;
        content: " ";
        height: 100px;
        margin-top: -100px;
        visibility: hidden;
    }

    #articleContent :focus {
        outline: none;
    }

    .toc-fixed {
        position: fixed;
        top: 64px;
    }

    .toc-widget {
        width: 345px;
        padding-left: 20px;
    }

    .toc-widget .toc-title {
        padding: 35px 0 15px 17px;
        font-size: 1.5rem;
        font-weight: bold;
        line-height: 1.5rem;
    }

    .toc-widget ol {
        padding: 0;
        list-style: none;
    }

    #toc-content {
        padding-bottom: 30px;
        overflow: auto;
    }

    #toc-content ol {
        padding-left: 10px;
    }

    #toc-content ol li {
        padding-left: 10px;
    }

    #toc-content .toc-link:hover {
        color: #42b983;
        font-weight: 700;
        text-decoration: underline;
    }

    #toc-content .toc-link::before {
        background-color: transparent;
        max-height: 25px;

        position: absolute;
        right: 23.5vw;
        display: block;
    }

    #toc-content .is-active-link {
        color: #42b983;
    }

    #floating-toc-btn {
        position: fixed;
        right: 15px;
        bottom: 76px;
        padding-top: 15px;
        margin-bottom: 0;
        z-index: 998;
    }

    #floating-toc-btn .btn-floating {
        width: 48px;
        height: 48px;
    }

    #floating-toc-btn .btn-floating i {
        line-height: 48px;
        font-size: 1.4rem;
    }
</style>
<div class="row">
    <div id="main-content" class="col s12 m12 l9">
        <!-- 文章内容详情 -->
<div id="artDetail">
    <div class="card">
        <div class="card-content article-info">
            <div class="row tag-cate">
                <div class="col s7">
                    
                    <div class="article-tag">
                        
                            <a href="/tags/linux/">
                                <span class="chip bg-color">linux</span>
                            </a>
                        
                            <a href="/tags/docker/">
                                <span class="chip bg-color">docker</span>
                            </a>
                        
                    </div>
                    
                </div>
                <div class="col s5 right-align">
                    
                    <div class="post-cate">
                        <i class="fas fa-bookmark fa-fw icon-category"></i>
                        
                            <a href="/categories/linux/" class="post-category">
                                linux
                            </a>
                        
                    </div>
                    
                </div>
            </div>

            <div class="post-info">
                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-minus fa-fw"></i>发布日期:&nbsp;&nbsp;
                    2021-03-31
                </div>
                

                

                
                <div class="info-break-policy">
                    <i class="far fa-file-word fa-fw"></i>文章字数:&nbsp;&nbsp;
                    2.3k
                </div>
                

                
                <div class="info-break-policy">
                    <i class="far fa-clock fa-fw"></i>阅读时长:&nbsp;&nbsp;
                    10 分
                </div>
                

                
            </div>
        </div>
        <hr class="clearfix">

        

        

        <div class="card-content article-card-content">
            <div id="articleContent">
                <h1 id="Docker"><a href="#Docker" class="headerlink" title="Docker"></a>Docker</h1><p>docker-ce  开源</p>
<p>docker-ee  收费</p>
<h2 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h2><ol>
<li><p>卸载原来的docker</p>
<pre class=" language-shell"><code class="language-shell">yum remove docker
</code></pre>
</li>
<li><p>下载阿里云的docker仓库</p>
<pre class=" language-shell"><code class="language-shell">wget -O /etc/yum.repos.d/docker-ce.repo  https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo 
</code></pre>
</li>
<li><p>安装</p>
<pre class=" language-shell"><code class="language-shell">yum install -y docker-ce
</code></pre>
</li>
<li><p>docker 加速器：文件存放路径<code>/etc/docker/daemon.json</code></p>
<pre class=" language-shell"><code class="language-shell">&#123;
    "registry-mirrors":[
        "https://1nj0zren.mirror.aliyuncs.com",
        "https://docker.mirrors.ustc.edu.cn",
        "http://f1361db2.m.daocloud.io",
        "https://registry.docker-cn.com"
    ]
&#125;
</code></pre>
</li>
<li><p>启动docker</p>
<pre class=" language-shell"><code class="language-shell">systemctl start docker
</code></pre>
</li>
</ol>
<h3 id="Docker简介"><a href="#Docker简介" class="headerlink" title="Docker简介"></a>Docker简介</h3><h4 id="镜像"><a href="#镜像" class="headerlink" title="镜像"></a>镜像</h4><p>类似于安装系统时候需要的iso镜像文件</p>
<h4 id="容器"><a href="#容器" class="headerlink" title="容器"></a>容器</h4><p>启动之后的镜像</p>
<h4 id="仓库"><a href="#仓库" class="headerlink" title="仓库"></a>仓库</h4><p>存放镜像</p>
<p>可以用公用的</p>
<p>可以有私有的</p>
<pre class=" language-python"><code class="language-python"><span class="token keyword">class</span> <span class="token class-name">myclass</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
    <span class="token keyword">def</span> <span class="token function">__init__</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">:</span>
        <span class="token keyword">pass</span>
    
m<span class="token operator">=</span>myclass<span class="token punctuation">(</span><span class="token punctuation">)</span>
</code></pre>
<h3 id="测试docker是否安装正常"><a href="#测试docker是否安装正常" class="headerlink" title="测试docker是否安装正常"></a>测试docker是否安装正常</h3><pre class=" language-shell"><code class="language-shell"># 语法：docker run 镜像名称
docker run hello-world  # 启动hello-world镜像，如果没有则下载最新版本

run  运行
hello-world 镜像名称
</code></pre>
<h2 id="Docker常用命令"><a href="#Docker常用命令" class="headerlink" title="Docker常用命令"></a>Docker常用命令</h2><h3 id="搜索镜像"><a href="#搜索镜像" class="headerlink" title="搜索镜像"></a>搜索镜像</h3><pre class=" language-shell"><code class="language-shell"># 语法：docker search 镜像名称
docker search mysql  # 搜索镜像名称

NAME(名字)                             DESCRIPTION(描述信息)                                     STARS(点赞数)              OFFICIAL(是否为官方)            AUTOMATED
mysql                             MySQL is a widely used, open-source relation…   8499                [OK]                
mariadb                           MariaDB is a community-developed fork of MyS…   2942                [OK]                
</code></pre>
<h3 id="下载镜像"><a href="#下载镜像" class="headerlink" title="下载镜像"></a>下载镜像</h3><pre class=" language-shell"><code class="language-shell"># 语法：docker pull 镜像名称
docker pull redis  # 下载redis镜像
</code></pre>
<h3 id="运行容器"><a href="#运行容器" class="headerlink" title="运行容器"></a>运行容器</h3><ul>
<li>如果本地没有此镜像,则会取docker hub 下载</li>
<li>如果有的话,则直接根据参数运行</li>
</ul>
<pre class=" language-shell"><code class="language-shell"># 语法：docker run 镜像名称
-d    # 后台启动
docker run --name redis-test -d redis   # 起名字启动
-c    # 启动并运行指定命令
docker run -d centos bash -c "while true;do echo helloworld;sleep 1;done" # 后台运行centos容器并没隔一秒输出helloworld。需要手动结束
-it  # 进入镜像操作
i   # 交互式操作
t   # 终端
exit   # 退出镜像

--rm   # 容器退出,并把容器删掉
docker run -it --rm ubuntu bash
</code></pre>
<h3 id="查看本地镜像"><a href="#查看本地镜像" class="headerlink" title="查看本地镜像"></a>查看本地镜像</h3><pre class=" language-shell"><code class="language-shell">docker images
-q 只显示id
</code></pre>
<h3 id="查看启动的容器"><a href="#查看启动的容器" class="headerlink" title="查看启动的容器"></a>查看启动的容器</h3><pre class=" language-shell"><code class="language-shell">docker ps
-a  显示启动过的所有的容器
</code></pre>
<h3 id="删除镜像"><a href="#删除镜像" class="headerlink" title="删除镜像"></a>删除镜像</h3><pre class=" language-shell"><code class="language-shell"># 语法：docker rmi 镜像名称
docker rmi redis  # 删除redis镜像
默认情况下不能删除启动过容器的镜像
-f 强制删掉
</code></pre>
<h3 id="删除容器"><a href="#删除容器" class="headerlink" title="删除容器"></a>删除容器</h3><pre class=" language-shell"><code class="language-shell"># 语法：docker rm [镜像名称或id(id只用输入前四位即可)]
docker rm redis  # 根据redis容器
默认不能删除启动中的容器
-f 强制删除
</code></pre>
<h3 id="退出容器不关闭容器"><a href="#退出容器不关闭容器" class="headerlink" title="退出容器不关闭容器"></a>退出容器不关闭容器</h3><pre class=" language-shell"><code class="language-shell">ctrl+p,q
</code></pre>
<h3 id="进入正在启动中的容器"><a href="#进入正在启动中的容器" class="headerlink" title="进入正在启动中的容器"></a>进入正在启动中的容器</h3><pre class=" language-shell"><code class="language-shell"># 语法：docker exec -it [镜像名或镜像id] bash
docker exec -it id|name bash   # 根据id前三位或者名称进入容器
bash 是进入容器后执行的命令
</code></pre>
<h3 id="查看容器的log日志"><a href="#查看容器的log日志" class="headerlink" title="查看容器的log日志"></a>查看容器的log日志</h3><pre class=" language-shell"><code class="language-shell"># 语法：docker logs [镜像名或镜像id]
docker logs id|name
-f 查看实时日志输出
</code></pre>
<h3 id="导出镜像"><a href="#导出镜像" class="headerlink" title="导出镜像"></a>导出镜像</h3><pre class=" language-shell"><code class="language-shell"># 语法：docker save -o [导出的文件名] [镜像名称]
docker save -o name imagename|id
docker save id|imagesname > centos.tar.gz
</code></pre>
<h3 id="导入镜像"><a href="#导入镜像" class="headerlink" title="导入镜像"></a>导入镜像</h3><pre class=" language-shell"><code class="language-shell">docker load -i centos.tar.gz
docker load < centos.tar.gz 
</code></pre>
<h3 id="提交-把容器导出为镜像"><a href="#提交-把容器导出为镜像" class="headerlink" title="提交(把容器导出为镜像)"></a>提交(把容器导出为镜像)</h3><pre class=" language-shell"><code class="language-shell">docker commit -m "message" 运行中的容器id
# or 二选一即可
docker commit 运行中的容器id 要生成的镜像名
</code></pre>
<h3 id="修改镜像名称"><a href="#修改镜像名称" class="headerlink" title="修改镜像名称"></a>修改镜像名称</h3><pre class=" language-shell"><code class="language-shell"># 语法：docker tag [镜像id或名称] [新名称]
docker tag redis newredis  # 修改redis镜像为newredis
如果不存在tag,则在原来的镜像基础上加上tag信息,如果存在原来的tag信息,则会复制一份
</code></pre>
<h3 id="删除所有的关闭状态下的容器"><a href="#删除所有的关闭状态下的容器" class="headerlink" title="删除所有的关闭状态下的容器"></a>删除所有的关闭状态下的容器</h3><pre class=" language-shell"><code class="language-shell">docker container prune
</code></pre>
<h3 id="数据卷"><a href="#数据卷" class="headerlink" title="数据卷"></a>数据卷</h3><p>将宿主机的文件挂载到容器里面</p>
<pre class=" language-shell"><code class="language-shell">-v 宿主机目录:容器目录
docker run -it -v /opt/myetc:/etc centos bash
</code></pre>
<p>将宿主机文件上传到容器中(在宿主机操作)</p>
<pre class=" language-shell"><code class="language-shell">docker cp 宿主机文件目录 容器名:要上传到的容器目录
docker cp /opt/myetc centos:/etc/bin
</code></pre>
<h3 id="端口映射"><a href="#端口映射" class="headerlink" title="端口映射"></a>端口映射</h3><pre class=" language-shell"><code class="language-shell">docker run -d -P redis  # 端口是随机产生
docker run -d -p 宿主机上的端口:容器内的端口 redis   # 指定端口
docker run --network=host redis  # 占用主机的端口运行，可与主机其它程序互通
# --network 有多种用法(参数)，自行百度
</code></pre>
<h3 id="查看容器的资源占用率"><a href="#查看容器的资源占用率" class="headerlink" title="查看容器的资源占用率"></a>查看容器的资源占用率</h3><pre class=" language-shell"><code class="language-shell"># 语法：docker stats 容器id或name
docker stats redis # 查看redis容器状态
</code></pre>
<pre class=" language-shell"><code class="language-shell">docker info  # 查看docker信息
docker inspect 镜像名称  # 查看镜像信息
</code></pre>
<h1 id="Dockerfile"><a href="#Dockerfile" class="headerlink" title="Dockerfile"></a>Dockerfile</h1><pre class=" language-shell"><code class="language-shell"># Dockerfile文件中要写的内容
FROM mycentos  # 指定基础镜像
RUN yum install -y wget # 执行命令
RUN mkdir /mydata
COPY a.txt /mydata # 将本地文件复制到镜像里面
ADD etc.tar.gz /mydata  # 将本地文件复制到进项内,如果是压缩包,则自动解压
WORKDIR /mydata # 指定工作目录,exec 进入时候默认的目录
ENV # 设置变量
VOLUME # 设置数据卷
EXPOSE 5900 # 设置端口
CMD ["nginx", "-g", "daemon off;"] # 执行命令
</code></pre>
<pre class=" language-shell"><code class="language-shell"># 语法：docker build -t [要生成的镜像名称] [要生成的目录(目录中必须有Dockerfile文件,-f可指定文件)]
docker build -t mydocker .   # 生成一个名为 mydocker 的镜像
docker build -t myflask -f flask.   # 指定flask为dockerfile文件并生成一个名为 myflask 的镜像
# 说明:执行该语句会依次执行Dockerfile中的每行命令,最终完成镜像生成.可用 docker images 命令进行查看
</code></pre>
<p>copy 和add的区别</p>
<p>add 是自动解压</p>
<p>CMD只能有一个,RUN可以有多个</p>
<h1 id="Docker本地私有仓库"><a href="#Docker本地私有仓库" class="headerlink" title="Docker本地私有仓库"></a>Docker本地私有仓库</h1><pre class=" language-shell"><code class="language-shell">docker run -d -p 5000:5000 -v /opt/register:/var/lib/registry registry   # 创建本地仓库或启动本地仓库
docker tag redis 127.0.0.1:5000/redis # 修改名称
docker push 127.0.0.1:5000/redis      # 上传到仓库
curl  127.0.0.1:5000/v2/_catalog      # 查看结果
docker pull 127.0.0.1:5000/redis      # 下载到仓库
</code></pre>
<p>要修改文件/etc/docker/daemon.json</p>
<pre class=" language-shell"><code class="language-shell">&#123;
    # 配置加速
    "registry-mirrors": [
        "https://1nj0zren.mirror.aliyuncs.com",
        "https://docker.mirrors.ustc.edu.cn",
        "http://f1361db2.m.daocloud.io",
        "https://registry.docker-cn.com"
    ],
    # 本地仓库地址
     "insecure-registries": [
    "192.168.182.130:5000"
  ]
&#125;
</code></pre>
<h1 id="docker-compose"><a href="#docker-compose" class="headerlink" title="docker-compose"></a>docker-compose</h1><p>什么是docker-compose？其实就是编排工具中的一个</p>
<p>编排(排版)工具有：swam、ocker-compose</p>
<p>yml 可以用来做配置文件</p>
<p>其它配置文件有：cfg、ini、xml、json</p>
<p>后缀名: yml yaml</p>
<p>数据类型：string、int、列表: [ ] -、字典:<code>key:value</code></p>
<p>使用YAML文件的有，YAML可直接转为python的字典：salt、ansible、docker-compose、k8s</p>
<h3 id="安装-1"><a href="#安装-1" class="headerlink" title="安装"></a>安装</h3><ul>
<li><p>手工安装</p>
<pre class=" language-shell"><code class="language-shell"># a.1. 可以通过https://github.com/docker/compose/releases 官方地址下载最新的docker-compose(如：sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose 或者下载后直接上传到服务器指定位置即可)
</code></pre>
<pre class=" language-shell"><code class="language-shell"># a.2. 如果系统没有安装curl,可以采用wget来安装（如：sudo wget -O /usr/local/bin/docker-compose https://github.com/docker/compose/releases/download/1.23.1/docker-compose-`uname -s`-`uname -m`）;要是用最新版本只需更换1.23.1版本号即可，其余勿更改！！！
</code></pre>
<pre class=" language-shell"><code class="language-shell"># b. 增加执行权限
sudo chmod +x /usr/local/bin/docker-compose
</code></pre>
<pre class=" language-shell"><code class="language-shell"># c、测试安装结果
docker-compose version
</code></pre>
</li>
<li><p>pip 安装</p>
<pre class=" language-shell"><code class="language-shell"># 1. 通过pip -v检查pip 是否安装及版本
# 2. yum -y install epel-release 安装pip基础
# 3. yum install python-pip 安装pip的python 支持
# 4. pip install --upgrade pip 完成pip的安装
# 5. pip install docker-compose 来安装docker-compose
</code></pre>
</li>
<li><p>命令补全</p>
<pre class=" language-shell"><code class="language-shell">curl -L https://raw.githubusercontent.com/docker/compose/1.8.0/contrib/completion/bash/docker-compose > /etc/bash_completion.d/docker-compose
</code></pre>
</li>
</ul>
<h3 id="使用"><a href="#使用" class="headerlink" title="使用"></a>使用</h3><p>docker-compose.yml文件,进阶版</p>
<pre class=" language-shell"><code class="language-shell">version: '3'
services:
   web: 
     build: 
        context: . # 指定dockerfile文件目录在哪
        dockerfile: dockerfile文件  # 指定目录中的dockerfile文件
     ports:
     - "3000:3000"
   redis:
     image: "redis"  # 镜像,默认使用本地的,如果没有则下载
</code></pre>
<p>Dockerfile文件</p>
<pre class=" language-shell"><code class="language-shell">from flask import Flask
from redis import Redis

app=Flask(__name__)
redis=Redis(host="redis",port=6379)

@app.route("/")
def index():
    count= redis.incr("hits")
    return "该页面被访问了&#123;&#125;次".format(count)

if __name__=="__main__":
    app.run(port=3000,host="0.0.0.0")
</code></pre>
<p>Docker-compose常用命令</p>
<pre class=" language-shell"><code class="language-shell">docker-compose build  # 重新构建容器
docker-compose ps # 查看运行中的容器
docker-compose images # 查看镜像
docker-compose rm # 删除所有停止的容器
</code></pre>
<p>docker-compose.yml文件,初级版</p>
<pre class=" language-shell"><code class="language-shell">version: '3' #版本
services:
   web: 
     build: . # dockerfile文件叫Dockerfile
     ports:
     - "3000:3000"
   redis:
     image: "redis"
</code></pre>
<p>例子：</p>
<pre class=" language-shell"><code class="language-shell">version: "3" 
services:

  redis:
    image: redis:alpine
    ports:
      - "6379"
    networks:
      - frontend

  db:
    image: postgres:9.4
    volumes:
      - db-data:/var/lib/postgresql/data
    networks:
      - backend

  vote:
    image: dockersamples/examplevotingapp_vote:before
    ports:
      - 5000:80
    networks:
      - frontend
    depends_on:  # 先谁启动
      - redis
      - db
</code></pre>
<p>dockerfile 部署crm</p>
<pre class=" language-shell"><code class="language-shell">FROM python:3.7-alpine3.10  # 基础镜像
RUN mkdir /data   # 执行命令
COPY requirements.txt /data # 复制文件
COPY mycrm /data  #复制目录的时候,,默认情况下是复制目录下的所有文件,如果要复制整个目录,则需要在后面加上目录名称
WORKDIR /data # 指定工作目录
RUN pip install -r requirements.txt -i https://pypi.douban.com/simple #安装python第三方的包
EXPOSE 8080 # 启动时候的端口,必须的
CMD python manage.py runserver 0.0.0.0:8080 #启动django
</code></pre>
<p>docker网络工具：calico(k8s也在使用的)</p>
<h1 id="示例：使用dockerfile部署flask"><a href="#示例：使用dockerfile部署flask" class="headerlink" title="示例：使用dockerfile部署flask"></a>示例：使用dockerfile部署flask</h1><p>第一步：编写flask项目，myflask.py</p>
<pre class=" language-shell"><code class="language-shell">from flask import Flask

app = Flask(__name__)

@app.route("/")
def index():
    return "Hello，This is my first dockerflask"

if __name__=="__main__":
    app.run(host="0.0.0.0",port=9000)
</code></pre>
<p>第二步：编写flask文件</p>
<pre class=" language-shell"><code class="language-shell">FROM python:3.7-alpine3.10
RUN mkdir /data
ADD myflask.py /data
RUN pip install flask -i https://pypi.douban.com/simple
WORKDIR /data
CMD ["python","myflask.py"]
</code></pre>
<p>第三步：生成镜像</p>
<pre class=" language-shell"><code class="language-shell">docker build -t myflask -f dockerflask .
</code></pre>
<p>第四步：查看镜像是否生成并启动验证,启动成功则镜像生成完毕。</p>
<pre class=" language-shell"><code class="language-shell">docker images
docker run -d -p 3000:9000 myflask
</code></pre>
<p>如果创建了本地仓库，则可上传至本地仓库，也就是把上面的本地私有仓库流程又走了一遍，改个镜像名称即可。我这里就不说啦。</p>

                
            </div>
            <hr/>

            

    <div class="reprint" id="reprint-statement">
        
            <div class="reprint__author">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-user">
                        文章作者:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="/about" rel="external nofollow noreferrer">aze</a>
                </span>
            </div>
            <div class="reprint__type">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-link">
                        文章链接:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="https://alinze.gitee.io/posts/49176.html">https://alinze.gitee.io/posts/49176.html</a>
                </span>
            </div>
            <div class="reprint__notice">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-copyright">
                        版权声明:
                    </i>
                </span>
                <span class="reprint-info">
                    本博客所有文章除特別声明外，均采用
                    <a href="https://creativecommons.org/licenses/by/4.0/deed.zh" rel="external nofollow noreferrer" target="_blank">CC BY 4.0</a>
                    许可协议。转载请注明来源
                    <a href="/about" target="_blank">aze</a>
                    !
                </span>
            </div>
        
    </div>

    <script async defer>
      document.addEventListener("copy", function (e) {
        let toastHTML = '<span>复制成功，请遵循本文的转载规则</span><button class="btn-flat toast-action" onclick="navToReprintStatement()" style="font-size: smaller">查看</a>';
        M.toast({html: toastHTML})
      });

      function navToReprintStatement() {
        $("html, body").animate({scrollTop: $("#reprint-statement").offset().top - 80}, 800);
      }
    </script>



            <div class="tag_share" style="display: block;">
                <div class="post-meta__tag-list" style="display: inline-block;">
                    
                        <div class="article-tag">
                            
                                <a href="/tags/linux/">
                                    <span class="chip bg-color">linux</span>
                                </a>
                            
                                <a href="/tags/docker/">
                                    <span class="chip bg-color">docker</span>
                                </a>
                            
                        </div>
                    
                </div>
                <div class="post_share" style="zoom: 80%; width: fit-content; display: inline-block; float: right; margin: -0.15rem 0;">
                    <link rel="stylesheet" type="text/css" href="/libs/share/css/share.min.css">
<div id="article-share">

    
    <div class="social-share" data-sites="twitter,facebook,google,qq,qzone,wechat,weibo,douban,linkedin" data-wechat-qrcode-helper="<p>微信扫一扫即可分享！</p>"></div>
    <script src="/libs/share/js/social-share.min.js"></script>
    

    

</div>

                </div>
            </div>
            
                <style>
    #reward {
        margin: 40px 0;
        text-align: center;
    }

    #reward .reward-link {
        font-size: 1.4rem;
        line-height: 38px;
    }

    #reward .btn-floating:hover {
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2), 0 5px 15px rgba(0, 0, 0, 0.2);
    }

    #rewardModal {
        width: 320px;
        height: 350px;
    }

    #rewardModal .reward-title {
        margin: 15px auto;
        padding-bottom: 5px;
    }

    #rewardModal .modal-content {
        padding: 10px;
    }

    #rewardModal .close {
        position: absolute;
        right: 15px;
        top: 15px;
        color: rgba(0, 0, 0, 0.5);
        font-size: 1.3rem;
        line-height: 20px;
        cursor: pointer;
    }

    #rewardModal .close:hover {
        color: #ef5350;
        transform: scale(1.3);
        -moz-transform:scale(1.3);
        -webkit-transform:scale(1.3);
        -o-transform:scale(1.3);
    }

    #rewardModal .reward-tabs {
        margin: 0 auto;
        width: 210px;
    }

    .reward-tabs .tabs {
        height: 38px;
        margin: 10px auto;
        padding-left: 0;
    }

    .reward-content ul {
        padding-left: 0 !important;
    }

    .reward-tabs .tabs .tab {
        height: 38px;
        line-height: 38px;
    }

    .reward-tabs .tab a {
        color: #fff;
        background-color: #ccc;
    }

    .reward-tabs .tab a:hover {
        background-color: #ccc;
        color: #fff;
    }

    .reward-tabs .wechat-tab .active {
        color: #fff !important;
        background-color: #22AB38 !important;
    }

    .reward-tabs .alipay-tab .active {
        color: #fff !important;
        background-color: #019FE8 !important;
    }

    .reward-tabs .reward-img {
        width: 210px;
        height: 210px;
    }
</style>

<div id="reward">
    <a href="#rewardModal" class="reward-link modal-trigger btn-floating btn-medium waves-effect waves-light red">赏</a>

    <!-- Modal Structure -->
    <div id="rewardModal" class="modal">
        <div class="modal-content">
            <a class="close modal-close"><i class="fas fa-times"></i></a>
            <h4 class="reward-title">你的赏识是我前进的动力</h4>
            <div class="reward-content">
                <div class="reward-tabs">
                    <ul class="tabs row">
                        <li class="tab col s6 alipay-tab waves-effect waves-light"><a href="#alipay">支付宝</a></li>
                        <li class="tab col s6 wechat-tab waves-effect waves-light"><a href="#wechat">微 信</a></li>
                    </ul>
                    <div id="alipay">
                        <img src="/loading.gif" data-original="/medias/reward/alipay.jpg" class="reward-img" alt="支付宝打赏二维码">
                    </div>
                    <div id="wechat">
                        <img src="/loading.gif" data-original="/medias/reward/wechat.png" class="reward-img" alt="微信打赏二维码">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        $('.tabs').tabs();
    });
</script>

            
        </div>
    </div>

    

    

    

    

    

    

    

    

    

<article id="prenext-posts" class="prev-next articles">
    <div class="row article-row">
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge left-badge text-color">
                <i class="fas fa-chevron-left"></i>&nbsp;上一篇</div>
            <div class="card">
                <a href="/posts/38573.html">
                    <div class="card-image">
                        
                        
                        <img src="/loading.gif" data-original="/medias/featureimages/14.jpg" class="responsive-img" alt="celery">
                        
                        <span class="card-title">celery</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            
                        
                    </div>
                    <div class="publish-info">
                        <span class="publish-date">
                            <i class="far fa-clock fa-fw icon-date"></i>2021-03-31
                        </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/categories/python/" class="post-category">
                                    python
                                </a>
                            
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/tags/python/">
                        <span class="chip bg-color">python</span>
                    </a>
                    
                    <a href="/tags/Celery/">
                        <span class="chip bg-color">Celery</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge right-badge text-color">
                下一篇&nbsp;<i class="fas fa-chevron-right"></i>
            </div>
            <div class="card">
                <a href="/posts/3eeb.html">
                    <div class="card-image">
                        
                        
                        <img src="/loading.gif" data-original="/medias/featureimages/12.jpg" class="responsive-img" alt="Hello World">
                        
                        <span class="card-title">Hello World</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            
                        
                    </div>
                    <div class="publish-info">
                            <span class="publish-date">
                                <i class="far fa-clock fa-fw icon-date"></i>2021-03-31
                            </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-user fa-fw"></i>
                            aze
                            
                        </span>
                    </div>
                </div>
                
            </div>
        </div>
        
    </div>
</article>

</div>



<!-- 代码块功能依赖 -->
<script type="text/javascript" src="/libs/codeBlock/codeBlockFuction.js"></script>

<!-- 代码语言 -->

<script type="text/javascript" src="/libs/codeBlock/codeLang.js"></script>


<!-- 代码块复制 -->

<script type="text/javascript" src="/libs/codeBlock/codeCopy.js"></script>


<!-- 代码块收缩 -->

<script type="text/javascript" src="/libs/codeBlock/codeShrink.js"></script>


    </div>
    <div id="toc-aside" class="expanded col l3 hide-on-med-and-down">
        <div class="toc-widget card" style="background-color: white;">
            <div class="toc-title"><i class="far fa-list-alt"></i>&nbsp;&nbsp;目录</div>
            <div id="toc-content"></div>
        </div>
    </div>
</div>

<!-- TOC 悬浮按钮. -->

<div id="floating-toc-btn" class="hide-on-med-and-down">
    <a class="btn-floating btn-large bg-color">
        <i class="fas fa-list-ul"></i>
    </a>
</div>


<script src="/libs/tocbot/tocbot.min.js"></script>
<script>
    $(function () {
        tocbot.init({
            tocSelector: '#toc-content',
            contentSelector: '#articleContent',
            headingsOffset: -($(window).height() * 0.4 - 45),
            collapseDepth: Number('0'),
            headingSelector: 'h2, h3, h4'
        });

        // modify the toc link href to support Chinese.
        let i = 0;
        let tocHeading = 'toc-heading-';
        $('#toc-content a').each(function () {
            $(this).attr('href', '#' + tocHeading + (++i));
        });

        // modify the heading title id to support Chinese.
        i = 0;
        $('#articleContent').children('h2, h3, h4').each(function () {
            $(this).attr('id', tocHeading + (++i));
        });

        // Set scroll toc fixed.
        let tocHeight = parseInt($(window).height() * 0.4 - 64);
        let $tocWidget = $('.toc-widget');
        $(window).scroll(function () {
            let scroll = $(window).scrollTop();
            /* add post toc fixed. */
            if (scroll > tocHeight) {
                $tocWidget.addClass('toc-fixed');
            } else {
                $tocWidget.removeClass('toc-fixed');
            }
        });

        
        /* 修复文章卡片 div 的宽度. */
        let fixPostCardWidth = function (srcId, targetId) {
            let srcDiv = $('#' + srcId);
            if (srcDiv.length === 0) {
                return;
            }

            let w = srcDiv.width();
            if (w >= 450) {
                w = w + 21;
            } else if (w >= 350 && w < 450) {
                w = w + 18;
            } else if (w >= 300 && w < 350) {
                w = w + 16;
            } else {
                w = w + 14;
            }
            $('#' + targetId).width(w);
        };

        // 切换TOC目录展开收缩的相关操作.
        const expandedClass = 'expanded';
        let $tocAside = $('#toc-aside');
        let $mainContent = $('#main-content');
        $('#floating-toc-btn .btn-floating').click(function () {
            if ($tocAside.hasClass(expandedClass)) {
                $tocAside.removeClass(expandedClass).hide();
                $mainContent.removeClass('l9');
            } else {
                $tocAside.addClass(expandedClass).show();
                $mainContent.addClass('l9');
            }
            fixPostCardWidth('artDetail', 'prenext-posts');
        });
        
    });
</script>

    

</main>




    <footer class="page-footer bg-color">
    
        <link rel="stylesheet" href="/libs/aplayer/APlayer.min.css">
<style>
    .aplayer .aplayer-lrc p {
        
        display: none;
        
        font-size: 12px;
        font-weight: 700;
        line-height: 16px !important;
    }

    .aplayer .aplayer-lrc p.aplayer-lrc-current {
        
        display: none;
        
        font-size: 15px;
        color: #42b983;
    }

    
    .aplayer.aplayer-fixed.aplayer-narrow .aplayer-body {
        left: -66px !important;
    }

    .aplayer.aplayer-fixed.aplayer-narrow .aplayer-body:hover {
        left: 0px !important;
    }

    
</style>
<div class="">
    
    <div class="row">
        <meting-js class="col l8 offset-l2 m10 offset-m1 s12"
                   server="netease"
                   type="playlist"
                   id="355992"
                   fixed='true'
                   autoplay='false'
                   theme='#42b983'
                   loop='all'
                   order='random'
                   preload='auto'
                   volume='0.7'
                   list-folded='true'
        >
        </meting-js>
    </div>
</div>

<script src="/libs/aplayer/APlayer.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js"></script>

    
    <div class="container row center-align" style="margin-bottom: 15px !important;">
        <div class="col s12 m8 l8 copy-right">
            Copyright&nbsp;&copy;
            
                <span id="year">2021-2022</span>
            
            <span id="year">2021</span>
            <a href="/about" target="_blank">aze</a>
            |&nbsp;Powered by&nbsp;<a href="https://hexo.io/" target="_blank">Hexo</a>
            |&nbsp;Theme&nbsp;<a href="https://github.com/blinkfox/hexo-theme-matery" target="_blank">Matery</a>
            <br>
            
            
            
            
            
			 
            <span id="busuanzi_container_site_pv">
                |&nbsp;<i class="far fa-eye"></i>&nbsp;总访问量:&nbsp;<span id="busuanzi_value_site_pv"
                    class="white-color"></span>&nbsp;次
            </span>
             
             
            <span id="busuanzi_container_site_uv">
                |&nbsp;<i class="fas fa-users"></i>&nbsp;总访问人数:&nbsp;<span id="busuanzi_value_site_uv"
                    class="white-color"></span>&nbsp;人
            </span>
             
            <br>
            
            <span id="sitetime">载入运行时间...</span>
            <script>
                function siteTime() {
                    var seconds = 1000;
                    var minutes = seconds * 60;
                    var hours = minutes * 60;
                    var days = hours * 24;
                    var years = days * 365;
                    var today = new Date();
                    var startYear = "2021";
                    var startMonth = "3";
                    var startDate = "14";
                    var startHour = "0";
                    var startMinute = "0";
                    var startSecond = "0";
                    var todayYear = today.getFullYear();
                    var todayMonth = today.getMonth() + 1;
                    var todayDate = today.getDate();
                    var todayHour = today.getHours();
                    var todayMinute = today.getMinutes();
                    var todaySecond = today.getSeconds();
                    var t1 = Date.UTC(startYear, startMonth, startDate, startHour, startMinute, startSecond);
                    var t2 = Date.UTC(todayYear, todayMonth, todayDate, todayHour, todayMinute, todaySecond);
                    var diff = t2 - t1;
                    var diffYears = Math.floor(diff / years);
                    var diffDays = Math.floor((diff / days) - diffYears * 365);
                    var diffHours = Math.floor((diff - (diffYears * 365 + diffDays) * days) / hours);
                    var diffMinutes = Math.floor((diff - (diffYears * 365 + diffDays) * days - diffHours * hours) /
                        minutes);
                    var diffSeconds = Math.floor((diff - (diffYears * 365 + diffDays) * days - diffHours * hours -
                        diffMinutes * minutes) / seconds);
                    if (startYear == todayYear) {
                        document.getElementById("year").innerHTML = todayYear;
                        document.getElementById("sitetime").innerHTML = "本站已安全运行 " + diffDays + " 天 " + diffHours +
                            " 小时 " + diffMinutes + " 分钟 " + diffSeconds + " 秒";
                    } else {
                        document.getElementById("year").innerHTML = startYear + " - " + todayYear;
                        document.getElementById("sitetime").innerHTML = "本站已安全运行 " + diffYears + " 年 " + diffDays +
                            " 天 " + diffHours + " 小时 " + diffMinutes + " 分钟 " + diffSeconds + " 秒";
                    }
                }
                setInterval(siteTime, 1000);
            </script>
            
            <br>
            
        </div>
        <div class="col s12 m4 l4 social-link social-statis">


    <a href="https://gitee.com/alinze" class="tooltipped" target="_blank" data-tooltip="访问我的Gitee" data-position="top" data-delay="50">
        <i class="fab fa-github"></i>
    </a>



    <a href="mailto:1124302640@qq.com" class="tooltipped" target="_blank" data-tooltip="邮件联系我" data-position="top" data-delay="50">
        <i class="fas fa-envelope-open"></i>
    </a>







    <a href="tencent://AddContact/?fromId=50&fromSubId=1&subcmd=all&uin=1124302640" class="tooltipped" target="_blank" data-tooltip="QQ联系我: 1124302640" data-position="top" data-delay="50">
        <i class="fab fa-qq"></i>
    </a>







    <a href="https://www.cnblogs.com/L521Z" class="tooltipped" target="_blank" data-tooltip="关注我的博客园: https://www.cnblogs.com/L521Z" data-position="top" data-delay="50">
        <i class="fab fa-juejin">博</i>
    </a>



</div>
    </div>
</footer>

<div class="progress-bar"></div>


    <!-- 搜索遮罩框 -->
<div id="searchModal" class="modal">
    <div class="modal-content">
        <div class="search-header">
            <span class="title"><i class="fas fa-search"></i>&nbsp;&nbsp;搜索</span>
            <input type="search" id="searchInput" name="s" placeholder="请输入搜索的关键字"
                   class="search-input">
        </div>
        <div id="searchResult"></div>
    </div>
</div>

<script type="text/javascript">
$(function () {
    var searchFunc = function (path, search_id, content_id) {
        'use strict';
        $.ajax({
            url: path,
            dataType: "xml",
            success: function (xmlResponse) {
                // get the contents from search data
                var datas = $("entry", xmlResponse).map(function () {
                    return {
                        title: $("title", this).text(),
                        content: $("content", this).text(),
                        url: $("url", this).text()
                    };
                }).get();
                var $input = document.getElementById(search_id);
                var $resultContent = document.getElementById(content_id);
                $input.addEventListener('input', function () {
                    var str = '<ul class=\"search-result-list\">';
                    var keywords = this.value.trim().toLowerCase().split(/[\s\-]+/);
                    $resultContent.innerHTML = "";
                    if (this.value.trim().length <= 0) {
                        return;
                    }
                    // perform local searching
                    datas.forEach(function (data) {
                        var isMatch = true;
                        var data_title = data.title.trim().toLowerCase();
                        var data_content = data.content.trim().replace(/<[^>]+>/g, "").toLowerCase();
                        var data_url = data.url;
                        data_url = data_url.indexOf('/') === 0 ? data.url : '/' + data_url;
                        var index_title = -1;
                        var index_content = -1;
                        var first_occur = -1;
                        // only match artiles with not empty titles and contents
                        if (data_title !== '' && data_content !== '') {
                            keywords.forEach(function (keyword, i) {
                                index_title = data_title.indexOf(keyword);
                                index_content = data_content.indexOf(keyword);
                                if (index_title < 0 && index_content < 0) {
                                    isMatch = false;
                                } else {
                                    if (index_content < 0) {
                                        index_content = 0;
                                    }
                                    if (i === 0) {
                                        first_occur = index_content;
                                    }
                                }
                            });
                        }
                        // show search results
                        if (isMatch) {
                            str += "<li><a href='" + data_url + "' class='search-result-title'>" + data_title + "</a>";
                            var content = data.content.trim().replace(/<[^>]+>/g, "");
                            if (first_occur >= 0) {
                                // cut out 100 characters
                                var start = first_occur - 20;
                                var end = first_occur + 80;
                                if (start < 0) {
                                    start = 0;
                                }
                                if (start === 0) {
                                    end = 100;
                                }
                                if (end > content.length) {
                                    end = content.length;
                                }
                                var match_content = content.substr(start, end);
                                // highlight all keywords
                                keywords.forEach(function (keyword) {
                                    var regS = new RegExp(keyword, "gi");
                                    match_content = match_content.replace(regS, "<em class=\"search-keyword\">" + keyword + "</em>");
                                });

                                str += "<p class=\"search-result\">" + match_content + "...</p>"
                            }
                            str += "</li>";
                        }
                    });
                    str += "</ul>";
                    $resultContent.innerHTML = str;
                });
            }
        });
    };

    searchFunc('/search.xml', 'searchInput', 'searchResult');
});
</script>

    <!-- 回到顶部按钮 -->
<div id="backTop" class="top-scroll">
    <a class="btn-floating btn-large waves-effect waves-light" href="#!">
        <i class="fas fa-arrow-up"></i>
    </a>
</div>


    <script src="/libs/materialize/materialize.min.js"></script>
    <script src="/libs/masonry/masonry.pkgd.min.js"></script>
    <script src="/libs/aos/aos.js"></script>
    <script src="/libs/scrollprogress/scrollProgress.min.js"></script>
    <script src="/libs/lightGallery/js/lightgallery-all.min.js"></script>
    <script src="/js/matery.js"></script>

    <!-- Baidu Analytics -->

    <!-- Baidu Push -->

<script>
    (function () {
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https') {
            bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
        } else {
            bp.src = 'http://push.zhanzhang.baidu.com/push.js';
        }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
</script>

    
    <script src="/libs/others/clicklove.js" async="async"></script>
    
    
    <script async src="/libs/others/busuanzi.pure.mini.js"></script>
    

    

    

    <!--腾讯兔小巢-->
    
    

    

    

    
    <script src="/libs/instantpage/instantpage.js" type="module"></script>
    


	
	<!--浏览器搞笑标题  自定义添加  -->
	<script type="text/javascript">
		var OriginTitile=document.title,st;
		document.addEventListener("visibilitychange",function(){
			document.hidden?(document.title="ヽ(●-`Д´-)ノ你要玩捉迷藏嘛",clearTimeout(st)):(document.title="(Ő∀Ő3)ノ好哦！",st=setTimeout(function(){document.title=OriginTitile},3e3))
		})
	</script>
	<!--动态线条背景-->
	<script type="text/javascript"
		color="122 103 238" opacity='0.7' zIndex="-2" count="200" src="//cdn.bootcss.com/canvas-nest.js/1.0.0/canvas-nest.min.js">
	</script>
	<!--樱花飘落效果 themes/matery/source/js/sakura.js-->
	<script type="text/javascript">
	//只在桌面版网页启用特效
	var windowWidth = $(window).width();
	if (windowWidth > 768) {
		document.write('<script type="text/javascript" src="/js/sakura.js"><\/script>');
	}
	</script>

<script>
            window.imageLazyLoadSetting = {
                isSPA: false,
                preloadRatio: 1,
                processImages: null,
            };
        </script><script>window.addEventListener("load",function(){var t=/\.(gif|jpg|jpeg|tiff|png)$/i,r=/^data:image\/[a-z]+;base64,/;Array.prototype.slice.call(document.querySelectorAll("img[data-original]")).forEach(function(a){var e=a.parentNode;"A"===e.tagName&&(e.href.match(t)||e.href.match(r))&&(e.href=a.dataset.original)})});</script><script>!function(n){n.imageLazyLoadSetting.processImages=i;var e=n.imageLazyLoadSetting.isSPA,r=(n.imageLazyLoadSetting.preloadRatio,Array.prototype.slice.call(document.querySelectorAll("img[data-original]")));function i(){e&&(r=Array.prototype.slice.call(document.querySelectorAll("img[data-original]")));for(var t,a=0;a<r.length;a++)0<=(t=(t=r[a]).getBoundingClientRect()).bottom&&0<=t.left&&t.top<=(n.innerHeight+240||document.documentElement.clientHeight+240)&&function(){var t,e,n,i,o=r[a];t=o,e=function(){r=r.filter(function(t){return o!==t})},n=new Image,i=t.getAttribute("data-original"),n.onload=function(){t.src=i,e&&e()},t.src!==i&&(n.src=i)}()}i(),n.addEventListener("scroll",function(){var t,e;t=i,e=n,clearTimeout(t.tId),t.tId=setTimeout(function(){t.call(e)},500)})}(this);</script><script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"debug":false,"model":{"jsonPath":"/live2dw/assets/haruto.model.json"},"display":{"position":"right","width":150,"height":300,"hOffset":20,"vOffset":-30},"mobile":{"show":true,"scale":0.5},"react":{"opacityDefault":0.7,"opacityOnHover":0.2},"log":false});</script></body>

</html>
